package cn.tiger.pojo.domain;

import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import jakarta.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 会员实体类
 * 
 * 对应数据库表membership，存储用户会员信息和充值记录
 * 使用JPA注解进行对象关系映射，支持会员状态管理、充值记录等功能
 * 
 * @author AI Backend Team
 * @version 1.0
 * @since 2025-09-26
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "membership")
public class Membership {
    /**
     * 会员记录唯一标识
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 用户ID（外键）
     */
    @Column(name = "user_id", nullable = false)
    private Long userId;

    /**
     * 会员类型（FREE-免费用户，VIP-会员用户）
     */
    @Column(name = "membership_type", length = 20, nullable = false)
    private String membershipType;

    /**
     * 会员开始时间
     */
    @Column(name = "start_time")
    private LocalDateTime startTime;

    /**
     * 会员到期时间
     */
    @Column(name = "expire_time")
    private LocalDateTime expireTime;

    /**
     * 充值金额
     */
    @Column(name = "amount", precision = 10, scale = 2)
    private BigDecimal amount;

    /**
     * 充值时间
     */
    @Column(name = "charge_time")
    private LocalDateTime chargeTime;

    /**
     * 状态（1-有效，0-失效）
     */
    @Column(name = "status")
    private Byte status;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @Column(name = "update_time")
    private LocalDateTime updateTime;
}